using Crosstales.RTVoice.Tool;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class test_speech : MonoBehaviour
{
    public SpeechText speechText;  
    public Sprite[] sprites;
    public Image image;

    string[] readContent = { 
        "老橡树",
        "男孩的朋友是一棵老橡树，每次出海，他都会对老橡树说，再见，我去钓鱼了",
        "一天，男孩在蓝色的大海上迷失了方向",
        "老橡树用力招手，我在这儿，可男孩只看得见蓝蓝的大海 "
        };
    public int idx = 0;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I) || Input.GetKeyDown(KeyCode.Space))
        {
            image.sprite = sprites[idx % sprites.Length];

            speechText.Text = readContent[idx % readContent.Length];
            speechText.Speak();

            idx++;
        }
    }
}
